using System;
using NetWorkMsg;
namespace NetMsg
{
    [Flags]
    public enum ModuleEnum
    {
        CrazyShopping = 1,
        CardAction = 2,
        WishMission = 4,
        Food = 8,
        Hatch = 16,
        Player = 32,
        Music = 64,
        Wallpaper = 128,
        ParallelWorld = 256,
        Card = 512,
        Chat = 1024,
        Phone = 2048,
        Dragon = 4096,
        Equip = 8192,
        Map = 16384,
        App = 32768,
        Gate = 65536,
    }
    
    public class RouteInfo
    {
        public readonly ModuleEnum Module;
        public readonly uint Message;
        public readonly Func<IUnPackable> Factory;
        public RouteInfo(ModuleEnum module, uint message, Func<IUnPackable> factory)
        {
            Module = module;
            Message = message;
            Factory = factory;
        }
    }
    
    public static class Router
    {
        private static readonly RouteInfo[] _routes;
        
        public static RouteInfo GetRouteInfo(uint index)
        {
            return index >= _routes.Length ? null : _routes[index];
        }
        
        static Router()
        {
            _routes = new RouteInfo[]
            {
                new RouteInfo(ModuleEnum.Gate, (uint)Gate.GateEnum.HeartP, () => new Gate.HeartP()),
                new RouteInfo(ModuleEnum.Gate, (uint)Gate.GateEnum.LoginP, () => new Gate.LoginP()),
                new RouteInfo(ModuleEnum.Gate, (uint)Gate.GateEnum.CreateP, () => new Gate.CreateP()),
                new RouteInfo(ModuleEnum.Gate, (uint)Gate.GateEnum.KickByReloginP, () => new Gate.KickByReloginP()),
                new RouteInfo(ModuleEnum.App, (uint)App.AppEnum.InstallP, () => new App.InstallP()),
                new RouteInfo(ModuleEnum.App, (uint)App.AppEnum.GetStoreAppInfoP, () => new App.GetStoreAppInfoP()),
                new RouteInfo(ModuleEnum.App, (uint)App.AppEnum.UpgradeAppP, () => new App.UpgradeAppP()),
                new RouteInfo(ModuleEnum.Map, (uint)Map.MapEnum.GetMapInfoP, () => new Map.GetMapInfoP()),
                new RouteInfo(ModuleEnum.Equip, (uint)Equip.EquipEnum.GetEquipBagP, () => new Equip.GetEquipBagP()),
                new RouteInfo(ModuleEnum.Equip, (uint)Equip.EquipEnum.UpgradeP, () => new Equip.UpgradeP()),
                new RouteInfo(ModuleEnum.Equip, (uint)Equip.EquipEnum.NoticeNewEquipP, () => new Equip.NoticeNewEquipP()),
                new RouteInfo(ModuleEnum.Dragon, (uint)Dragon.DragonEnum.GetDragonsP, () => new Dragon.GetDragonsP()),
                new RouteInfo(ModuleEnum.Dragon, (uint)Dragon.DragonEnum.UnInstallDragonP, () => new Dragon.UnInstallDragonP()),
                new RouteInfo(ModuleEnum.Dragon, (uint)Dragon.DragonEnum.DragonFuseP, () => new Dragon.DragonFuseP()),
                new RouteInfo(ModuleEnum.Dragon, (uint)Dragon.DragonEnum.NewDragonP, () => new Dragon.NewDragonP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.GetPhoneP, () => new Phone.GetPhoneP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.GetPhoneRecordsP, () => new Phone.GetPhoneRecordsP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.DeleteContactP, () => new Phone.DeleteContactP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.NoticeBeDeleteP, () => new Phone.NoticeBeDeleteP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.AddBlackListP, () => new Phone.AddBlackListP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.AddContactP, () => new Phone.AddContactP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.RepAddContactRepP, () => new Phone.RepAddContactRepP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.NoticeRepAddP, () => new Phone.NoticeRepAddP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.CallPlayerP, () => new Phone.CallPlayerP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.NoticeCallP, () => new Phone.NoticeCallP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.NoticeReplyCallP, () => new Phone.NoticeReplyCallP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.NoticeAskQuestionP, () => new Phone.NoticeAskQuestionP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.NoticeAnswerP, () => new Phone.NoticeAnswerP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.NoticeSpeakP, () => new Phone.NoticeSpeakP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.NoticeVoiceInfoP, () => new Phone.NoticeVoiceInfoP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.NoticeHangUpP, () => new Phone.NoticeHangUpP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.SearchByIdP, () => new Phone.SearchByIdP()),
                new RouteInfo(ModuleEnum.Phone, (uint)Phone.PhoneEnum.NoticeFriendOnlineP, () => new Phone.NoticeFriendOnlineP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.GetSystemNoticeP, () => new Chat.GetSystemNoticeP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.NoticeNewNotieceP, () => new Chat.NoticeNewNotieceP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.GetRoomChatInfoP, () => new Chat.GetRoomChatInfoP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.SearchRoomP, () => new Chat.SearchRoomP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.JoinRoomP, () => new Chat.JoinRoomP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.NoticeJoinRoomP, () => new Chat.NoticeJoinRoomP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.NoticeChgRoomStrOpP, () => new Chat.NoticeChgRoomStrOpP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.ChangeRoomStrOptionP, () => new Chat.ChangeRoomStrOptionP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.ChangeRoomNumOptionP, () => new Chat.ChangeRoomNumOptionP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.NoticeChgRoomNumOpP, () => new Chat.NoticeChgRoomNumOpP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.BuyTimeP, () => new Chat.BuyTimeP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.NoticeRoomNotExistsP, () => new Chat.NoticeRoomNotExistsP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.GetActivityRewardP, () => new Chat.GetActivityRewardP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.NoticeExitRoomSuccP, () => new Chat.NoticeExitRoomSuccP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.NoticeExitP, () => new Chat.NoticeExitP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.GetRoomInfoP, () => new Chat.GetRoomInfoP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.NoticeRoomMsgP, () => new Chat.NoticeRoomMsgP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.GetFriendOfflineChatInfoP, () => new Chat.GetFriendOfflineChatInfoP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.SendChatInfoP, () => new Chat.SendChatInfoP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.NoticeChatInfoP, () => new Chat.NoticeChatInfoP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.GetFriendCircleP, () => new Chat.GetFriendCircleP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.NoticeNewTrendP, () => new Chat.NoticeNewTrendP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.GetBarrageP, () => new Chat.GetBarrageP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.HitRewardP, () => new Chat.HitRewardP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.GetChatInfoP, () => new Chat.GetChatInfoP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.InviteInRoomP, () => new Chat.InviteInRoomP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.NoticeInviteP, () => new Chat.NoticeInviteP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.GetInviteInfoP, () => new Chat.GetInviteInfoP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.HasUnReadInviteP, () => new Chat.HasUnReadInviteP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.GetNpcChatInfoP, () => new Chat.GetNpcChatInfoP()),
                new RouteInfo(ModuleEnum.Chat, (uint)Chat.ChatEnum.GetRecentContactInfoP, () => new Chat.GetRecentContactInfoP()),
                new RouteInfo(ModuleEnum.Card, (uint)Card.CardEnum.GetCardInfoP, () => new Card.GetCardInfoP()),
                new RouteInfo(ModuleEnum.Card, (uint)Card.CardEnum.GetBrandGroupP, () => new Card.GetBrandGroupP()),
                new RouteInfo(ModuleEnum.Card, (uint)Card.CardEnum.UpgradeCardProgressP, () => new Card.UpgradeCardProgressP()),
                new RouteInfo(ModuleEnum.Card, (uint)Card.CardEnum.SignMatchP, () => new Card.SignMatchP()),
                new RouteInfo(ModuleEnum.Card, (uint)Card.CardEnum.PickUpP, () => new Card.PickUpP()),
                new RouteInfo(ModuleEnum.Card, (uint)Card.CardEnum.PutOnP, () => new Card.PutOnP()),
                new RouteInfo(ModuleEnum.Card, (uint)Card.CardEnum.RecvEmojiP, () => new Card.RecvEmojiP()),
                new RouteInfo(ModuleEnum.Card, (uint)Card.CardEnum.GetStoreInfoP, () => new Card.GetStoreInfoP()),
                new RouteInfo(ModuleEnum.Card, (uint)Card.CardEnum.BuyCommodityP, () => new Card.BuyCommodityP()),
                new RouteInfo(ModuleEnum.Card, (uint)Card.CardEnum.RefreshStoreP, () => new Card.RefreshStoreP()),
                new RouteInfo(ModuleEnum.Card, (uint)Card.CardEnum.GetMailableCardsP, () => new Card.GetMailableCardsP()),
                new RouteInfo(ModuleEnum.Card, (uint)Card.CardEnum.NoticeNewMailableCardP, () => new Card.NoticeNewMailableCardP()),
                new RouteInfo(ModuleEnum.ParallelWorld, (uint)ParallelWorld.ParallelWorldEnum.GetParallelWorldP, () => new ParallelWorld.GetParallelWorldP()),
                new RouteInfo(ModuleEnum.ParallelWorld, (uint)ParallelWorld.ParallelWorldEnum.CancelMakeBottleP, () => new ParallelWorld.CancelMakeBottleP()),
                new RouteInfo(ModuleEnum.ParallelWorld, (uint)ParallelWorld.ParallelWorldEnum.SendDriftBottleP, () => new ParallelWorld.SendDriftBottleP()),
                new RouteInfo(ModuleEnum.ParallelWorld, (uint)ParallelWorld.ParallelWorldEnum.GetDriftBottleP, () => new ParallelWorld.GetDriftBottleP()),
                new RouteInfo(ModuleEnum.ParallelWorld, (uint)ParallelWorld.ParallelWorldEnum.ChangeToRewardP, () => new ParallelWorld.ChangeToRewardP()),
                new RouteInfo(ModuleEnum.ParallelWorld, (uint)ParallelWorld.ParallelWorldEnum.ChangeToConfirmP, () => new ParallelWorld.ChangeToConfirmP()),
                new RouteInfo(ModuleEnum.ParallelWorld, (uint)ParallelWorld.ParallelWorldEnum.GetMatchRewardP, () => new ParallelWorld.GetMatchRewardP()),
                new RouteInfo(ModuleEnum.Wallpaper, (uint)Wallpaper.WallpaperEnum.GetWallpaperInfoP, () => new Wallpaper.GetWallpaperInfoP()),
                new RouteInfo(ModuleEnum.Wallpaper, (uint)Wallpaper.WallpaperEnum.ChangeWallpaperP, () => new Wallpaper.ChangeWallpaperP()),
                new RouteInfo(ModuleEnum.Music, (uint)Music.MusicEnum.GetMusicInfoP, () => new Music.GetMusicInfoP()),
                new RouteInfo(ModuleEnum.Player, (uint)Player.PlayerEnum.LoginInfoP, () => new Player.LoginInfoP()),
                new RouteInfo(ModuleEnum.Player, (uint)Player.PlayerEnum.DayRefreshP, () => new Player.DayRefreshP()),
                new RouteInfo(ModuleEnum.Player, (uint)Player.PlayerEnum.RecoveryStaminaP, () => new Player.RecoveryStaminaP()),
                new RouteInfo(ModuleEnum.Player, (uint)Player.PlayerEnum.GetPlayerSummaryP, () => new Player.GetPlayerSummaryP()),
                new RouteInfo(ModuleEnum.Hatch, (uint)Hatch.HatchEnum.GetHatchInfoP, () => new Hatch.GetHatchInfoP()),
                new RouteInfo(ModuleEnum.Hatch, (uint)Hatch.HatchEnum.GetHatchEggInfoP, () => new Hatch.GetHatchEggInfoP()),
                new RouteInfo(ModuleEnum.Hatch, (uint)Hatch.HatchEnum.IdentifyP, () => new Hatch.IdentifyP()),
                new RouteInfo(ModuleEnum.Hatch, (uint)Hatch.HatchEnum.AnalyzeP, () => new Hatch.AnalyzeP()),
                new RouteInfo(ModuleEnum.Hatch, (uint)Hatch.HatchEnum.HatchP, () => new Hatch.HatchP()),
                new RouteInfo(ModuleEnum.Hatch, (uint)Hatch.HatchEnum.NoticeNewEggsP, () => new Hatch.NoticeNewEggsP()),
                new RouteInfo(ModuleEnum.Food, (uint)Food.FoodEnum.GetFoodInfoP, () => new Food.GetFoodInfoP()),
                new RouteInfo(ModuleEnum.Food, (uint)Food.FoodEnum.NoticeNewFoodP, () => new Food.NoticeNewFoodP()),
                new RouteInfo(ModuleEnum.WishMission, (uint)WishMission.WishMissionEnum.GetWishMissionsP, () => new WishMission.GetWishMissionsP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionEnterSummaryP, () => new CardAction.ActionEnterSummaryP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionEnterDetailP, () => new CardAction.ActionEnterDetailP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionBeginPickP, () => new CardAction.ActionBeginPickP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionPickUpEndP, () => new CardAction.ActionPickUpEndP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionTurnBeginP, () => new CardAction.ActionTurnBeginP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionTurnBeginEndP, () => new CardAction.ActionTurnBeginEndP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionEnterTurnP, () => new CardAction.ActionEnterTurnP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionAutoFightP, () => new CardAction.ActionAutoFightP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionAutoFightEndP, () => new CardAction.ActionAutoFightEndP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionPickUpSP, () => new CardAction.ActionPickUpSP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionPickUpEP, () => new CardAction.ActionPickUpEP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionPutOnP, () => new CardAction.ActionPutOnP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionAttackP, () => new CardAction.ActionAttackP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionPropertyChangeP, () => new CardAction.ActionPropertyChangeP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionSetPropertyP, () => new CardAction.ActionSetPropertyP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionDeadP, () => new CardAction.ActionDeadP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionReviveSP, () => new CardAction.ActionReviveSP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionReviveEP, () => new CardAction.ActionReviveEP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionBackP, () => new CardAction.ActionBackP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionMoveP, () => new CardAction.ActionMoveP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionModifyStaminaLimitP, () => new CardAction.ActionModifyStaminaLimitP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionModifyStaminaP, () => new CardAction.ActionModifyStaminaP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionUseSkillP, () => new CardAction.ActionUseSkillP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionAddBuffP, () => new CardAction.ActionAddBuffP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionTriggerBuffP, () => new CardAction.ActionTriggerBuffP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionRmvBuffP, () => new CardAction.ActionRmvBuffP()),
                new RouteInfo(ModuleEnum.CardAction, (uint)CardAction.CardActionEnum.ActionMatchOverP, () => new CardAction.ActionMatchOverP()),
                new RouteInfo(ModuleEnum.CrazyShopping, (uint)CrazyShopping.CrazyShoppingEnum.GetCrazyShoppingP, () => new CrazyShopping.GetCrazyShoppingP()),
                new RouteInfo(ModuleEnum.CrazyShopping, (uint)CrazyShopping.CrazyShoppingEnum.GetOrderInfoP, () => new CrazyShopping.GetOrderInfoP()),
                new RouteInfo(ModuleEnum.CrazyShopping, (uint)CrazyShopping.CrazyShoppingEnum.GetOrderRecordsP, () => new CrazyShopping.GetOrderRecordsP()),
                new RouteInfo(ModuleEnum.CrazyShopping, (uint)CrazyShopping.CrazyShoppingEnum.GetStoreInfoP, () => new CrazyShopping.GetStoreInfoP()),
                new RouteInfo(ModuleEnum.CrazyShopping, (uint)CrazyShopping.CrazyShoppingEnum.BuyCommodityP, () => new CrazyShopping.BuyCommodityP()),
                new RouteInfo(ModuleEnum.CrazyShopping, (uint)CrazyShopping.CrazyShoppingEnum.RefreshStoreP, () => new CrazyShopping.RefreshStoreP()),
                new RouteInfo(ModuleEnum.CrazyShopping, (uint)CrazyShopping.CrazyShoppingEnum.GetPostInfoP, () => new CrazyShopping.GetPostInfoP()),
                new RouteInfo(ModuleEnum.CrazyShopping, (uint)CrazyShopping.CrazyShoppingEnum.GetAddressInfosP, () => new CrazyShopping.GetAddressInfosP()),
                new RouteInfo(ModuleEnum.CrazyShopping, (uint)CrazyShopping.CrazyShoppingEnum.AddAddressP, () => new CrazyShopping.AddAddressP()),
                new RouteInfo(ModuleEnum.CrazyShopping, (uint)CrazyShopping.CrazyShoppingEnum.MakeOrderP, () => new CrazyShopping.MakeOrderP()),
            };
        }
    }
}
